/*!
 * FileName: luogu-1144.cpp
 * This Problem is on luogu. The ID of the problem is 1144. 
 * Copyright(c) 2019 Shu_Yu_Mo
 * MIT Licensed
 * Luogu: https://www.luogu.org/space/show?uid=44615
 * Github: https://github.com/oldsuold/
 * Gitee: https://gitee.com/Shu_Yu_Mo/
 * These words were created by an amazing tool written by Shu_Yu_Mo.
 */
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstring>
#include<iostream>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#define inf 0x7fffffff
using namespace std;
const int _N = 1000100;
const int _M = 2000100;
const int MOD = 100003;
inline int read()
{
    char c = getchar(); int sign = 1; int x = 0;
    while(c > '9' || c < '0') { if(c=='-')sign = -1; c = getchar(); } 
    while(c <= '9' && c >= '0') { x *= 10; x += c - '0'; c = getchar(); }
    return x * sign;
}
int n, m;

struct edges{
	int node;
	int nxt;
}edge[_M];
int head[_N];
int tot = 0;
void add(int u, int v)
{
	if(/*M[H1] != 0 || M[H2] != 0 || */u == v) return;
	edge[++tot].nxt = head[u];
	edge[tot].node = v;
	head[u] = tot;
	
	edge[++tot].nxt = head[v];
	edge[tot].node = u;
	head[v] = tot;
}
queue<int> Q;
int dis[_N];
bool vis[_N];
int times[_N];
void BFS(int s = 1)
{
	Q.push(s);
	vis[s] = true;
	times[s] = 1;
	dis[s] = 0;
	while(!Q.empty())
	{
		int NowNode = Q.front(); Q.pop();
		for(register int i = head[NowNode];i;i = edge[i].nxt)
		{
			int SonNode = edge[i].node;
			if(!vis[SonNode]) 
			{
				vis[SonNode] = true;
				dis[SonNode] = dis[NowNode] + 1;
				
				Q.push(SonNode);
			}
			if(dis[SonNode] == dis[NowNode] + 1)
				times[SonNode] += times[NowNode],
				times[SonNode] %= MOD;
		}
	}
}
int main()
{
	n = read(), m = read();
	for(register int i = 1;i <= m;i++)
		add(read(), read());
	BFS();
	for(register int i = 1;i <= n;i++)
		printf("%d\n", times[i]);
    return 0;
}
